import { useRoutes } from 'react-router-dom'
// import Home from"../view/home/home"
// import About from"../view/about/about"
import { lazy } from 'react';


const Home = lazy(() => import(/* webpackChunkName: "home" */ '../view/home/home'))

const LayOut = lazy(() => import(/* webpackChunkName: "layout" */ '../view/layout/layout'))
const Goods = lazy(() => import(/* webpackChunkName: "goods" */ '../view/goods/goods'))
const Login = lazy(() => import(/* webpackChunkName: "login" */ '../view/login/login'))
const Regist = lazy(() => import(/* webpackChunkName: "regist" */ '../view/regist/regist'))
const Help = lazy(() => import(/* webpackChunkName: "help" */ '../view/help/help'))
const Nofound = lazy(() => import(/* webpackChunkName: "nofound" */ '../view/nofound/nofound'))
const Record = lazy(() => import(/* webpackChunkName: "record" */ '../view/record/record'))
const GetMoney = lazy(() => import(/* webpackChunkName: "record" */ '../view/getmoney/getmoney'))

function GenerateRouters() {
    const routes = useRoutes([
        {
            path: "/",
            element: <LayOut />,
            children: [
                {
                    index: true,
                    element: <Home />
                },
                {
                    path: 'goods',
                    element: <Goods />
                },

                {
                    path: 'regist',
                    element: <Regist />
                },

                {
                    path: "help",
                    element: <Help />
                },
                {
                    path: "record",
                    element: <Record />
                },
                {
                    path: "getmoney",
                    element: <GetMoney />
                }

            ]
        },
        {
            path: '/login',
            element: <Login />
        },
        {
            path: '*',
            element: < Nofound />
        },
    ]);
    return routes
}
export default GenerateRouters